package com.coolingme.notandor;

import com.coolingme.notandor.expression.BracketExpression;

/**
 * 表达式计算器
 *
 * @author wangyue
 * @date 2022/12/25 13:02
 */
public class ExpressionCalculator {

    private BracketExpression bracketExpression;

    /**
     * 表达式
     */
    private String expression;

    public ExpressionCalculator(String expression) {
        this.expression = expression;

        // TODO 校验表达式格式
        bracketExpression = new BracketExpression(expression);
    }

    /**
     * 计算文本是否命中表达式
     *
     * @return 是否命中
     */
    public Boolean calculate(String content) {
        Boolean result = bracketExpression.interpret(content);
        return result;
    }

}
